<template>
    <van-address-list v-model="chosenAddressId" :list="list" :disabled-list="disabledList" default-tag-text="默认"
        @add="onAdd" @edit="onEdit" add-button-text="去支付" @click="gopay" />
    <van-cell-group inset>
        <van-cell title="订单号" :value="getOrderApiData.orderId" />
        <van-cell title="订单时间" :value="getOrderApiData.create_time" />
        <van-cell title="订单内容" :value="getOrderApiData.product_code" />
        <van-cell title="订单价格" :value="(getOrderApiData.totalPrice/100).toFixed(2)" />
    </van-cell-group>
</template>

<script setup>
import { getOrderApi } from '@/api/api';
import { ref } from 'vue';
import { useRoute } from 'vue-router';
let getOrderApiData = ref([])
let route = useRoute()
getOrderApi(route.params.orderId).then(res => {
    getOrderApiData.value = res.data.data
    payApiData.value={
        orderId:res.data.data.orderId,
        subject:res.data.data.product_code,
        totalPrice:(res.data.data.totalPrice/100).toFixed(2)
    }
})
const chosenAddressId = ref('1');
const list = [
    {
        id: '1',
        name: '张三',
        tel: '13000000000',
        address: '浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室',
        isDefault: true,
    },
];
import { payApi } from '@/api/api';
let payApiData=ref([])
let gopay=()=>{
    payApi(payApiData.value).then(res=>{
        window.open(res.data.data,'_blank')
    })
}
</script>

<style lang="scss" scoped></style>